/**
 * PageJS-2.0 核心文件
 * 2018年11月14日 10点35分
 * nico@coser.pub
 */
const _config = require('../data/config');
const _base = require('_base');
/**
 * _builer PageJs 加工工厂函数
 */
function _builer() {
  /**
   * 引入加载器
   */
  let appendBaseApply = _base.appendBaseApply.bind(this);
  let appendBaseApplyGroup = _base.appendBaseApplyGroup.bind(this);
  /**
   * @var baseApplyGroupList 批量引入支持组
   */
  let baseApplyGroupList = [
    "_ObjectEditor",
  ]
  for (let i = 0; i < baseApplyGroupList.length; i++) {
    appendBaseApplyGroup(baseApplyGroupList[i])
  }
  /**
   * @var baseApplyList 批量引入支持
   */
  let baseApplyList = [
    "_data","_require"
  ]
  for (let i = 0; i < baseApplyList.length; i++) {
    appendBaseApply(baseApplyList[i])
  }
  /**
   * @var baseApplyGroupList 批量引入支持组
   */
  baseApplyGroupList = [
    "_AppjsApply","_MagicEventApply","_LifecycleManager",
  ]
  for (let i = 0; i < baseApplyGroupList.length; i++) {
    appendBaseApplyGroup(baseApplyGroupList[i])
  }


  /** 加载自动加载插件 */
  let applyNameLib = require("../apply/_config.js")._autoLoad;
  for (let i = 0; i < applyNameLib.length; i++) {
    try { this._apply(applyNameLib[i]); } catch (igore) { }
  }
  return this;
}
module.exports._builer = function (that) { return _builer.bind(that)();};

